#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 210;
const int M = 1e9 + 7;

int s[N][N], t[N][N];
int n;
char ch;

int b[N][N];

void rotate()
{
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <=n ; j++)
            b[j][n + 1 - i] = s[i][j];

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            s[i][j] = b[i][j];
}

bool check()
{
     int x1 = N, x2 = -1, y1 = N, y2 = -1, x3 = N, x4 = -1, y3 = N, y4 = -1, c1 = 0, c2 = 0;
    for (int i = 1 ; i <= n ; i++){
        for (int j = 1 ; j <= n ; j++) {
            if (s[i][j]) {
                x1 = min(x1, i), y1 = min(y1, j);
                x2 = max(x2, i), y2 = max(y2, j);
                c1++;
            }
        }
    }


    for (int i = 1 ; i <= n ; i++){
        for (int j = 1 ; j <= n ; j++) {
            if (t[i][j]) {
                x3 = min(x3, i), y3 = min(y3, j);
                x4 = max(x4, i), y4 = max(y4, j);
                c2++;
            }
        }
    }


    if (c1 != c2) return false;
    if (x2-x1 != x4-x3 || y2-y1 != y4-y3) return false; 

    int dif_row = x2-x1, dif_col = y2-y1;

    bool flag = true;
    for (int i = 0; i < dif_row; i++)
    {
        if (!flag)
            break;
        for (int j = 0; j < dif_col; j++)
        {
            if (s[x1+i][y1+j] != t[x3+i][y3+j])
            {
                flag = false;
                break;
            }
        }
    }
    return flag;
}
int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);

    cin >> n;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
        {
            cin >> ch;
            s[i][j] = (ch == '#');
        }

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
        {
            cin >> ch;
            t[i][j] = (ch == '#');
        }

    bool flag = false;

    for (int i = 1; i <= 4; i++)
    {
        rotate();
        if (check())
        {
            flag = true;
            break;
        }
    }

    puts(flag ? "Yes" : "No");
    return 0;
}